﻿<UserControl x:Class="FIFP.DashBoard.Views.MainDashBoard"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"             
    DataContext="{Binding MainPageVM,Source={StaticResource ServiceLocator}}"
    xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    mc:Ignorable="d"
    d:DesignHeight="1028" d:DesignWidth="1920">

    <Grid x:Name="LayoutRoot">
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="Loaded">
                <i:InvokeCommandAction Command="{Binding PageLoadCommand}" 
        							CommandParameter="{Binding ElementName=grdChild}" />
            </i:EventTrigger>
        </i:Interaction.Triggers>
        <Grid.Background>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="#FF1C2028" Offset="0"/>
                <GradientStop Color="#FF1C202B" Offset="1"/>
                <!--<GradientStop Color="#FF353C48" Offset="0.245"/>
                <GradientStop Color="#FF353C48" Offset="0.78"/>-->
            </LinearGradientBrush>
        </Grid.Background>
        <controlsToolkit:BusyIndicator x:Name="MainPageBusyIndicator" BusyContent="{Binding LoadingMessage}"
                    IsBusy="{Binding IsLoading}" DisplayAfter="0">
            <Viewbox Margin="0" Stretch="Fill">
        		<Grid Height="1028" Width="1920" Margin="10">
        			<Grid.RowDefinitions>
        				<RowDefinition Height="Auto"/>
        				<RowDefinition Height="Auto"/>
        				<RowDefinition Height="*"/>
        			</Grid.RowDefinitions>

        			<Grid>    
        				<Grid.ColumnDefinitions>
        					<ColumnDefinition Width="0.5*"/>
        					<ColumnDefinition Width="0.5*"/>
        				</Grid.ColumnDefinitions>
        				<Image Margin="0,0,0,10" Source="/FIFP.DashBoard;component/Images/ADMA.png" Stretch="Fill" Height="40" RenderTransformOrigin="0.5,0.5" VerticalAlignment="Top" Width="264" HorizontalAlignment="Left" Grid.Column="0"/>
        				<!--<TextBlock Margin="0,0,10,0" Grid.Column="1" TextWrapping="Wrap" Text="Current Scenario:" VerticalAlignment="Center" HorizontalAlignment="Right" Style="{StaticResource PopupContent}"/>-->
                        <StackPanel HorizontalAlignment="Right" Grid.Column="1" Margin="0">
                            <HyperlinkButton x:Name="lnkUserGuid" Tag="usermanual" Content="User Guide" VerticalAlignment="Center" HorizontalAlignment="Right" Cursor="Hand" Margin="0" Style="{StaticResource HyperlinkbuttonFontStyleNormalNew}">
                                <i:Interaction.Triggers>
                                    <i:EventTrigger  EventName="Click">
                                        <i:InvokeCommandAction  Command="{Binding UserGuideCommand}" CommandParameter="{Binding ElementName=lnkUserGuid}" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </HyperlinkButton>
                            <TextBlock Margin="0,2,0,0" TextWrapping="Wrap" Text="{Binding ScenarioName}" VerticalAlignment="Center" HorizontalAlignment="Right" Style="{StaticResource ContentStyle}"/>    
                        </StackPanel>
        				
        			</Grid>
                
        			<Grid Margin="0,0,0,10" Grid.Row="1">
        				<Grid.RowDefinitions>
        					<RowDefinition Height="Auto"/>
        					<RowDefinition Height="Auto"/>
        				</Grid.RowDefinitions>
        				<Grid.ColumnDefinitions>
        					<ColumnDefinition Width="0.25*"/>
        					<ColumnDefinition Width="0.50*"/>
        					<ColumnDefinition Width="0.25*"/>
        				</Grid.ColumnDefinitions>

        				<RadioButton x:Name="rdImport" Tag="import" IsChecked="{Binding IsImportChecked}" Content="Home" Margin="0,0,1,0" Cursor="Hand" Style="{StaticResource RadioButtonStyleMenu}">
        					<i:Interaction.Triggers>
        						<i:EventTrigger EventName="Click">
        							<i:InvokeCommandAction Command="{Binding NavigationCommand}" 
        								CommandParameter="{Binding ElementName=rdImport}" />
        						</i:EventTrigger>
        					</i:Interaction.Triggers>
        				</RadioButton>
                        <RadioButton x:Name="rdOptimization" IsChecked="{Binding IsOptimizationChecked}" IsEnabled="{Binding IsIntegrationEnabled}" Tag="optimization" Content="Integration/Optimization" Margin="0,0,1,0" Style="{StaticResource RadioButtonStyleMenu}" Grid.Column="1" Cursor="Hand">
        					<i:Interaction.Triggers>
        						<i:EventTrigger EventName="Click">
        							<i:InvokeCommandAction Command="{Binding NavigationCommand}" 
        								CommandParameter="{Binding ElementName=rdOptimization}" />
        						</i:EventTrigger>
        					</i:Interaction.Triggers>
        				</RadioButton>
                        <RadioButton x:Name="rdScenario" IsChecked="{Binding IsScenarioChecked}" IsEnabled="{Binding IsScenarioCompareEnabled}" Tag="scenario" Content="Scenario Comparison" Margin="0,0,1,0" Style="{StaticResource RadioButtonStyleMenu}" Grid.Column="2" Cursor="Hand">
        					<i:Interaction.Triggers>
        						<i:EventTrigger EventName="Click">
        							<i:InvokeCommandAction Command="{Binding NavigationCommand}" 
        								CommandParameter="{Binding ElementName=rdScenario}" />
        						</i:EventTrigger>
        					</i:Interaction.Triggers>
        				</RadioButton>


        				<Grid Grid.Column="0" Grid.Row="1" Margin="0,3,0,3" Visibility="Collapsed">
        					<Grid.ColumnDefinitions>
        						<ColumnDefinition Width="Auto"/>
        						<ColumnDefinition Width="*"/>
        					</Grid.ColumnDefinitions>
                            <Button Tag="saveas" x:Name="btnSaveAs" Content="Save as" Margin="0" Width="140" Style="{Binding SaveAsStyle}" Grid.Column="0" Cursor="Hand">
        						<i:Interaction.Triggers>
        							<i:EventTrigger  EventName="Click">
        								<i:InvokeCommandAction Command="{Binding SaveCommand}" 
        									CommandParameter="{Binding ElementName=btnSaveAs}"  />
        							</i:EventTrigger>
        						</i:Interaction.Triggers>
        					</Button>
                            <Button Tag="save" x:Name="btnSave" Content="Save" Margin="0,0,30,0" Width="140" Style="{Binding SaveStyle}" Grid.Column="1" Cursor="Hand">
        						<i:Interaction.Triggers>
        							<i:EventTrigger  EventName="Click">
        								<i:InvokeCommandAction Command="{Binding SaveCommand}" 
        									CommandParameter="{Binding ElementName=btnSave}"  />
        							</i:EventTrigger>
        						</i:Interaction.Triggers>
        					</Button>

        				</Grid>

        				<Grid x:Name="OptSubMenu" Grid.Row="1" Grid.Column="1" Margin="0,3,0,3" Visibility="{Binding IsSubMenuVisible}" >
        					<Grid.ColumnDefinitions>
        						<ColumnDefinition Width="0.333*"/>
        						<ColumnDefinition Width="0.333*"/>
        						<ColumnDefinition Width="0.333*"/>
        					</Grid.ColumnDefinitions>




                            <RadioButton Grid.Column="0" x:Name="rdOverlap" Tag="overlap" IsChecked="{Binding IsOverLapChecked}" Content="Overlap Management" Margin="0,0,1,0" Style="{StaticResource RadioButtonStyleMenu}" Visibility="{Binding IsSubMenuVisible}" Cursor="Hand">
        						<i:Interaction.Triggers>
        							<i:EventTrigger EventName="Click">
        								<i:InvokeCommandAction Command="{Binding NavigationCommand}" 
        									CommandParameter="{Binding ElementName=rdOverlap}" />
        							</i:EventTrigger>
        						</i:Interaction.Triggers>
        					</RadioButton>
                            <RadioButton x:Name="rdLinkedShutdown" Tag="shutdown" IsEnabled="{Binding IsLSDEnabled}" IsChecked="{Binding IsLinkedSDChecked}"  Content="Linked Shutdown Management" Margin="0,0,1,0" Style="{StaticResource RadioButtonStyleMenu}" Grid.Column="1" Visibility="{Binding IsSubMenuVisible}" Cursor="Hand">
        						<i:Interaction.Triggers>
        							<i:EventTrigger EventName="Click">
        								<i:InvokeCommandAction Command="{Binding NavigationCommand}" 
        									CommandParameter="{Binding ElementName=rdLinkedShutdown}" />
        							</i:EventTrigger>
        						</i:Interaction.Triggers>
        					</RadioButton>
                            <RadioButton x:Name="rdOpMng" Tag="optmng" IsChecked="{Binding IsOptMngChecked}"  Content="Optimization Management" Margin="0,0,1,0" Style="{StaticResource RadioButtonStyleMenu}" Grid.Column="2" Visibility="{Binding IsSubMenuVisible}" Cursor="Hand">

        						<i:Interaction.Triggers>
        							<i:EventTrigger EventName="Click">
        								<i:InvokeCommandAction Command="{Binding NavigationCommand}" 
        									CommandParameter="{Binding ElementName=rdOpMng}" />
        							</i:EventTrigger>
        						</i:Interaction.Triggers>
        					</RadioButton>
        				</Grid>

        				<Grid Grid.Column="2" Grid.Row="1" Margin="0,3,0,3" Visibility="{Binding IsSubMenuVisible}" HorizontalAlignment="Right">
        					<Grid.ColumnDefinitions>
        						<ColumnDefinition Width="*"/>
        						<ColumnDefinition Width="*"/>
								<ColumnDefinition Width="*"/>
        					</Grid.ColumnDefinitions>
                            <Button Tag="save" Grid.Column="2" HorizontalAlignment="Left" x:Name="btnSaveNew" IsEnabled="{Binding IsSaveButtonEnabled}" Content="Save" Margin="10,0,0,0" Width="120" Style="{StaticResource OverlapButtonStyle}" Cursor="Hand">
        						<i:Interaction.Triggers>
        							<i:EventTrigger  EventName="Click">
        								<i:InvokeCommandAction Command="{Binding SaveCommand}" 
        									CommandParameter="{Binding ElementName=btnSaveNew}"  />
        							</i:EventTrigger>
        						</i:Interaction.Triggers>
        					</Button>
                            <Button Tag="calculate" Grid.Column="1" x:Name="btnCalculate" IsEnabled="{Binding IsCalculateButtonEnabled}" Content="Calculate EC" Margin="10,0,0,0" HorizontalAlignment="Right" Width="120" Style="{StaticResource OverlapButtonStyle}" Cursor="Hand">
        						<i:Interaction.Triggers>
        							<i:EventTrigger  EventName="Click">
        								<i:InvokeCommandAction Command="{Binding SaveCommand}" 
        									CommandParameter="{Binding ElementName=btnCalculate}"  />
        							</i:EventTrigger>
        						</i:Interaction.Triggers>
        					</Button>
                            <Button Tag="undo" HorizontalAlignment="Left" x:Name="btnUndo" IsEnabled="{Binding IsUnodButtonEnabled}" Content="Undo" Margin="10,0,0,0" Width="120" Style="{StaticResource OverlapButtonStyle}" Cursor="Hand">
        						<i:Interaction.Triggers>
        							<i:EventTrigger  EventName="Click">
        								<i:InvokeCommandAction Command="{Binding UndoCommand}" 
        									CommandParameter="{Binding ElementName=btnUndo}"  />
        							</i:EventTrigger>
        						</i:Interaction.Triggers>
        					</Button>
        				</Grid>

        			</Grid>
        			<Grid Grid.Row="2" x:Name="grdChild" Grid.Column="1"/>
        		</Grid>
        	</Viewbox>
        </controlsToolkit:BusyIndicator>
    </Grid>
</UserControl>
